"""
学习GenricAPIView的五大子类来实现CURD
"""

from rest_framework.generics import GenericAPIView
from rest_framework.mixins import ListModelMixin,CreateModelMixin
from rest_framework.mixins import RetrieveModelMixin,UpdateModelMixin,DestroyModelMixin

# =====五大子类======
from rest_framework.generics import ListAPIView,CreateAPIView
from rest_framework.generics import RetrieveAPIView,UpdateAPIView,DestroyAPIView
from .serializers import *


# 视图继承这五大子类之后，我们只需要通过类属性
# queryset指定操作的目标数据查询集
# serializer_class指定操作数据所使用的序列化器


class BooksAPIView(ListAPIView,CreateAPIView):
    queryset = BookInfo.objects.all()
    serializer_class = BookInfoModelSerializer



class BookAPIView(RetrieveAPIView, UpdateAPIView, DestroyAPIView):
    queryset = BookInfo.objects.all()
    serializer_class = BookInfoModelSerializer






